


//  #include  "plcgw_cfg.h"


#ifndef _plcgw_config_h
#define _plcgw_config_h

#include "gw_ktj_api_config.h"

//#define  IS_RTOS  
#define  EXT_RAM_ATTR


#define THREE_PHASE

// 信号量
#define TOK_PLC_CMD      	100
#define TOK_PLC_REMOTE      101
#define TOK_DB_XUCHUAN   102
#define TOK_VER_FILE     103 
#define TOK_PLC_RAW      104
#define TOK_KTB          105

#define TOK_485_CH0       106
#define TOK_485_CH1       107
#define TOK_485_CH2       108
#define TOK_485_CH3       109
#define TOK_485_CH4       110
#define TOK_485_CH5       111
#define TOK_485_CH6       112
#define TOK_485_CH7       113


#define TOK_DB_DATA      120
#define TOK_DB_MSG       121
//#define TOK_DB_XUCHUAN   112
//#define TOK_VER_FILE     113 



//#define APP_PATH_PC     "/mnt/hgfs/linux_proj/boli/src/"



#if   F133_ktj_gw_app_v2_4_19_Enable   
#define APP_PATH          "/mnt/UDISK/iot_gw/"
#define APP_DATA_PATH     "/mnt/UDISK/iot_gw/data/"
#define DATA_FILE_PATH    "/mnt/UDISK/iot_gw/data/"
#define CFG_FILE_PATH   "/mnt/UDISK/iot_gw/data/cfg_dat"
#define WWW_PATH		"/mnt/UDISK/iot_gw/www"

#else
#define APP_PATH          "/mnt/UDISK/gw_plc/"
#define APP_DATA_PATH     "/mnt/UDISK/gw_plc/data/"
#define DATA_FILE_PATH    "/mnt/UDISK/gw_plc/data/"

#endif 


#define UPDATE_FILE_NAME  "update_file.txt"

#define STA_OTA_FILE_PATH   "/mnt/UDISK/iot_gw/data/ota/sta"

#define LOG_PATH         "/mnt/UDISK/log/"
#define OP_LOG_PATH      "/mnt/UDISK/log/op/"







//#define CFG_FILE_NAME    "./config.ini"



#define LOG_PATH         "/mnt/UDISK/log/"
#define OP_LOG_PATH         "/mnt/UDISK/log/op/"
#define SOCKET_LOG_PATH  "/mnt/UDISK/log/"
#define SOCKET_LOG_FILENAME "socket_cnnt.log"

#define CFG_DIR     "data/cfg_dat/"
#define DAT_DIR     "run_dat/"
#define LOG_DIR     "run_dat/log/"
#define SCRIPT_DIR  "script/"
#define APP_BIN_DIR "bin/"
#define APP_SO_DIR  "bin/so/"
#define APP_CFG_DIR  "cfg_dat/"
#define APP_BIN_BAK_DIR "app_bak/bin/"
#define APP_BAK_DIR "app_bak/"
#define APP_CFG_BAK_DIR "app_bak/cfg_dat/"

/*****
/mnt/UDISK/gw_plc/data/ota/gw/
/mnt/UDISK/gw_plc/data/ota/gw/bak/
*******/
#define OTA_GW_DIR   "ota/gw/"
#define OTA_DEVICE_DIR   "ota/device/"
#define OTA_CCO_DIR   "ota/cco/"
#define OTA_STA_DIR   "ota/sta/"
#define OTA_BAK_DIR   "bak/"

/**
filename : name+版本号
fwgw-20230415a
fwdevice-20230509d

***/
#define FILENAME_GW  	"fwgw-"
#define FILENAME_DEVICE  "fwdevice-"
#define FILENAME_CCO  	"fwcco-"
#define FILENAME_STA  	"fwsta-"

#define GATEWAY_INI_FILE  "gateway.ini"
#define GATEWAY_INI_BIN   "gw_ini.bin"
#define CHANNEL_FILE      "channel.csv"

#define DEVICE_LIST_FILE   "device_list.csv"
#define UPLOAD_FILE      "upload.csv"

#define GROUP_FILE_END    "_group.csv"
#define POINT_FILE_END    "_point.csv"
#define CTRL_FILE_END     "_ctrl.csv"

//#define DB_FILE_NAME      "all_data.db"
#define CHANNEL_DB_NAME   "channel.db"
#define DB_MSG_NAME       "all_msg.db"
#define DB_DAT_NAME       "all_data.db"
#define DB_XUCHUAN_NAME   "xuchuan.db"

#define VER_FLIE          "ver.dat"
#define CFG_VER_FLIE      "cfg_ver.dat"

#define SINGLE_LAMP_DATA_FILE   "singleLampData.dat"
#define MULT_LAMP_DATA_FILE     "multLampData.dat"

#define WHITELIST_FILE    "whitelist.dat"
#define ROADLAMP_LIST_FILE   "roadlampList.dat"
#define BREAKER_LIST_FILE    "breakerList.dat"

#define EXEC_LOG_FILE       "op.log"
#define EXEC_LOG_FILE_HEAD           "op_"
#define EXEC_LOG_FILE_EXT_NAME       ".log"



//#define PLC_MAIN_UART   "/dev/ttyS3"  //  升辉板
#define PLC_MAIN_UART   "/dev/ttyS5"    // 路灯集中器板
#define PLC_MAIN_UART_BAUD_RATE   115200

#define SHELL_MAIN_UART   "/dev/ttyS4"
#define SHELL_MAIN_UART_BAUD_RATE   115200

#define  portTICK_PERIOD_MS  10


#define MSG_QUEUE_PATH   "/home"
#define MSG_ID_SEND_PLC   100 
#define MSG_TYPE            1234
#define MSG_ID_PLC_QUEUE_PUSH   120
#define MSG_ID_PLC_QUEUE_POP    121
#define MSG_ID_SYS_PUSH         130
#define MSG_ID_TO_MANAGER       131
#define MSG_ID_FROM_MANAGER     132
#define MSG_ID_APP2LOG          133


#define GW_APP_OTA_CMD   "updatePlcgw"


#define MAX_MSG_SIZE          2048

#define ALL_FUNC
//#define MASTER_UART_EN
//#define USER_MQTT_EN
//#define KEY_EN
#define ENABLE_BLE                 // ʹ��ble
#define ENABLE_MQTT


#define MAX_PATH_FILENAME      64
#define DEFAULT_DPID_NUM         512

#define MAX_DEV_TYPE       256


#define MAX_TEI     104
#define MAX_LED     MAX_TEI
#define MAX_NAME_LEN   32 
#define TEI_TAB_NUM    16

#define MAX_DEVICE_NUM   2048

#define MAX_WHITELIST_NUM    MAX_TEI
#define MAX_TOPU_NUM         MAX_TEI

#define MAX_ROADLAMP_NODE_NUM  300   

#define MAX_ONLINE_NUM     254
#define MAX_SCENE_NUM      128

#define MIN_REPORT_INTERVAL     60  // 最小上报间隔：60秒

#define GROUP_ADDR_START   128
#define GROUP_ADDR_MIN     128
#define MAX_GROUP          64
#define GROUP_ADDR_MAX     (GROUP_ADDR_MIN+MAX_GROUP)   // 192

#define INVALIDE_GROUP_ADDR   0xff
#define INVALIDE_DEVICE_ADDR  0xffff


#define ADDR_ALL_DEVICE    0xff

#define MAX_SCENE_ADDR     255
#define MAX_SCENE_IN_DEVICE  31  // ÿ���豸���Զ�����ٸ�����
#define MAX_DEVICE_IN_SCENE   64     // һ�������������ö��ٸ��豸(��)
#define MAX_ATTR_NUM       16
#define MAX_ATTR_PKG_LEN   32
#define MAX_NAME_LEN       32
#define MAX_PID_LEN        32
#define MAX_BIND_START_DEV_NUM   64  // ��忪��/�������ȴ����豸�����Ŀ
#define MAX_BIND_SCENE_NUM       32   // һ���豸���󶨶��ٸ�scene

// dev_sync_mask_tab[XX]
#define NUM_OF_DEV_SYNC_MASK    (MAX_WHITELIST_NUM/32 + 1)


#define MAX_SCENE_COMB_LEN  300
#define MAX_TIMERING_TASK   255   // 128


#define MAX_DEVICE_IN_SUBSCENE    8
#define MAX_ATTR_SIZE             12
//#define MAX_SUBSCENE_IN_SCENE       16  // 255
//#define MAX_SCENE                 254
#define MAX_SCENE_COMB            254

#define MAX_LAMP_IN_ONE_NODE      64  //  一个节点最多带多少个灯

#define STATUS_UPDATE_INTERVAL    30 // 10 // 3  //  更新节点status的时间间隔


#endif

